import {Md5} from "ts-md5/dist/md5"
/**
	保接受后台传过来的 User
*/
export class User{
	/*用户 id*/
	userId:number;
	/**账号*/
	account:string;
	/**密码*/
	password:string;
	/**用户名字*/
	name:string;
	/**角色 id 数组*/
	roleIds:number[];
	/**创建用户 id*/
	createUserId:number;
	/**创建时间*/
	createTime:Date;
	/**最后修改用户 id*/
	updateUserId:number;
	/**最后修改时间*/
	updateTime:Date;
	/**备注*/
	note:string;
	/**数据有效性*/
	active:boolean;

	/**是否选中 checked*/
	checked:boolean=false;

	constructor(userId:number,account:string,password:string,name:string,roleIds:number[],createUserId:number,createTime:Date,updateUserId:number,updateTime:Date,note:string,active:boolean){
		this.userId=userId;
		this.account=account;
		this.password=password;
		this.name=name;
		this.roleIds=roleIds;
		this.createUserId=createUserId;
		this.createTime=createTime;
		this.updateUserId=updateUserId;
		this.updateTime=updateTime;
		this.note=note;
		this.active=active;
	}


	/**
		对密码进行MD5加密
	*/
	md5Password():void{
		this.password.length!==32&&(this.password=Md5.hashStr(this.password).toString());		
	}

}